//
//  UserInfoTableViewCell.m
//  Light
//
//  Created by MiaoYe on 15/9/16.
//  Copyright (c) 2015年 骁唐. All rights reserved.
//

#import "UserInfoTableViewCell.h"

@implementation UserInfoTableViewCell
{
    ButtonBlock Buttonblock;
}

- (void)awakeFromNib {
    _lineViewHigh.constant = 0.5;
    [_cellHeadImage.layer setMasksToBounds:YES];
    [_cellHeadImage.layer setCornerRadius:35.0f];
    _cellResultTextField.delegate = self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (IBAction)ButtonAction:(id)sender {
    if (Buttonblock != nil) {
        if (sender == _manBut) {
            Buttonblock(manButton,self);
        }else if (sender == _womanBut) {
            Buttonblock(womanButton,self);
        }
    }
}

- (void)setButtonAction:(ButtonBlock)block {
     Buttonblock = block;
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return YES;
}

- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
    NSLog(@"-=======");
    if (textField.tag == 100*3)
    {//出生日期
        NSLog(@"第三行");
    }else if (textField.tag == 100*4)
    {//身高
        NSLog(@"第四行");
    }else if (textField.tag == 100*5)
    {//体重
        NSLog(@"第五行");
    }else if (textField.tag == 100*7)
    {//城市
        NSLog(@"第七行");
    }
    NSDictionary *dic = @{@"indexPath":[NSString stringWithFormat:@"%ld",(long)textField.tag],@"text":textField.text};
    NSNotification *notification = [[NSNotification alloc]initWithName:@"change" object:nil userInfo:dic];
    [[NSNotificationCenter defaultCenter] postNotification:notification];//发送通知

    return YES;
}

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    NSDictionary *dic = @{@"indexPath":[NSString stringWithFormat:@"%ld",(long)textField.tag]};
    NSNotification *notification = [[NSNotification alloc]initWithName:@"changeIndex" object:nil userInfo:dic];
    [[NSNotificationCenter defaultCenter] postNotification:notification];
    return YES;
}


@end
